Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zj cp/end lifetime sale #1492

Merged
merged 2 commits into from
Nov 5, 2024
Merged

Zj cp/end lifetime sale #1492

merged 2 commits into from
Nov 5, 2024

Conversation

zacjones93
Copy link
Contributor

allowPurchase=true

if allowPurchase=true is set as a query param then the user can purchase lifetime subscription
image

no allowPurchase=true

if allowPurchase is anything other than true then this form will be displayed that will prompt the user to enter email to be notified when a future sale goes live. If the user is logged in there will just be a button.

This will add them to a segment in customerio Interested in Lifetime that is data-driven and checks if the attribute interested_in_lifetime_since exists. When the user signs up a data is set so we know when they signed up and can filter them out of the segment if we run a sale.

image
image

gif

Copy link

vercel bot commented Nov 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
egghead-io-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 0:18am

Comment on lines +25 to +30
const {contact_id} = await requestSignInEmail(submittedEmail)

cioIdentify(contact_id, {
email: submittedEmail,
[INTERESTED_IN_LIFETIME_SINCE]: Math.floor(Date.now() / 1000),
})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if a user isn't signed in, they can enter their email which will send a sign in request to rails (effectively creating an account if there isn't one) which we can use the contact_id to identify the user in CIO

})
} else if (subscriber) {
cioIdentify(subscriber.id, {
[INTERESTED_IN_LIFETIME_SINCE]: Math.floor(Date.now() / 1000),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CIO needs you to divide by 1000 for their time format

Comment on lines +1 to +3
const INTERESTED_IN_LIFETIME_SINCE = 'interested_in_lifetime_since'

export {INTERESTED_IN_LIFETIME_SINCE}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we didn't want to have special strings for CIO attributes in the file we were working with so created this util file to organize any attributes we are setting in egghead-next

@Creeland Creeland merged commit d9c69c8 into main Nov 5, 2024
6 checks passed
@Creeland Creeland deleted the zj-cp/end-lifetime-sale branch November 5, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants